/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.engin.treasury;

import ac.engin.archive.clients;
import ac.settings.dataModel;

/**
 *
 * @author ismail
 */
public class otherEx extends ac.ui.FrameOperationTemplat implements dataModel {

    String Table = TABLE_treasury_otherEx;
    String actionField = "treasury_id";

    ac.engin.treasury.treasuryData t = new ac.engin.treasury.treasuryData();
    clients c = new clients();

    public void reProcess(String tid, double am) {
        t.AddToTreasury(tid, am);
        ac.GUI.index.updateTinfo(tid, true);
    }

    public void doProcess(String tid, double am) {

        t.CutToTreasury(tid, am);
        ac.GUI.index.updateTinfo(tid, true);

    }

    public String getlastID() {
        String[] r;
        r = db.getRow(Table, " max(id) as m ", "");
        return r[0];

    }

    public String[] getRow(String id) {
        String[] r;
        r = db.getRow(Table, "*", "id='" + id + "'");
        return r;

    }

    public double getAmount(String id) {

        double d = 0d;

        String[] oldb_data = getRow(id);

        if (oldb_data[2] != null) {

            d = Double.parseDouble(oldb_data[6]);
        }

        return d;

    }

}
